package com.samuel.service.impl;

import com.samuel.dao.PaymentDao;
import com.samuel.entities.Payment;
import com.samuel.service.PaymentService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author a neng huang
 * @since 2021-02-24 21:41
 */
@Service
@Transactional
public class PaymentServiceImpl implements PaymentService {

    @Resource
    private PaymentDao paymentDao;

    @Override
    @Transactional(rollbackFor = {Exception.class})
    public int create(Payment payment) {
        return paymentDao.create(payment);
    }

    @Override
    public Payment getById(String id) {
        return paymentDao.getById(id);
    }

    @Override
    public List<Payment> getAll() {
        return paymentDao.listAll();
    }
}
